// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.

// This behavior can be attached to a textbox to enable auto-complete/auto-suggest
// scenarios.
Type.registerNamespace('GridControl');
GridControl.SpinnerExtenderBehavior = function(element) {
   
    GridControl.SpinnerExtenderBehavior.initializeBase(this, [element]);
      
}
GridControl.SpinnerExtenderBehavior.prototype = {
    initialize: function() {
    
        GridControl.SpinnerExtenderBehavior.callBaseMethod(this, 'initialize');
        //debugger;
        var id=this.get_element().id;
        var objConfig=this.getObject();
        objConfig.value= Ext.fly(id).dom.value;
        var dtField= new Ext.ux.form.Spinner(objConfig);
        dtField.applyTo(id);
       
    },
    
    get_minValue: function() {
       
        return this._minValue;
    },
    set_minValue: function(value) {
        this._minValue = value;
    },
    get_maxValue:function(){
        return this._maxValue;
    },
    set_maxValue:function(value){
        this._maxValue=value;
    },
    get_incrementValue:function(){
        return this._incrementValue;
    },
    set_incrementValue:function(value){
        this._incrementValue=value;
    },
    get_alternateIncrementValue:function(){
        return this._alternateIncrementValue;
    },
    set_alternateIncrementValue:function(value){
        this._alternateIncrementValue=value;
    },
    getObject:function(){
        var objRet={};
        for(var p in this){
            if(typeof(this[p])!="function" && typeof(this[p])!="object"){
                objRet[p.replace("_","")]=this[p];
            }
        }
        return objRet;
    }
}
GridControl.SpinnerExtenderBehavior.registerClass('GridControl.SpinnerExtenderBehavior', AjaxControlToolkit.BehaviorBase);